const userMap = {
  admin: {
    roles: ['admin'],
    token: 'admin',
    introduction: '我是超级管理员',
    avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
    name: 'Super Admin',
    code: 200
  },
  editor: {
    roles: ['editor'],
    token: 'editor',
    introduction: '我是编辑',
    avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
    name: 'Normal Editor',
    code: 200
  }
}

export default {
  loginByUsername: config => {
    const { username } = JSON.parse(config.data)
    return [200,userMap[username]]
  },
  getUserInfo: config => {
    const { token } = config.params
    if (userMap[token]) {
      return [200,userMap[token]]
    } else {
      return [200,null]
    }
  },
  logout: () => {
    return [200,{code: 200}]
  }
}
